package com.air.designmodel.nine;

/**
 * @author shent
 */
public class RemoteControlTest {
    public static void main(String[] args) {
        //创建遥控器和灯对象
        SimpleRemoteControl remoteControl = new SimpleRemoteControl();
        Light light = new Light();
        //灯和命令绑定,指定命令打开哪个灯
        LightOnCommand lightOnCommand = new LightOnCommand(light);
        LightOffCommand lightOffCommand = new LightOffCommand(light);

        //设置遥控器的命令
        remoteControl.setCommand(lightOnCommand);
        remoteControl.buttonWasPressed();
        remoteControl.setCommand(lightOffCommand);
        remoteControl.buttonWasPressed();
    }
}
